package com.robert.textdemo;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;

/**
 * @author: robert
 * @date: 2017-11-23
 * @time: 10:47
 * @说明:
 */
public class FirstDialog extends Dialog {
    private final Context context;

    public FirstDialog(@NonNull Context context) {
        super(context);
        this.context = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_first);
        findViewById(R.id.show_second).setOnClickListener(v -> {
            this.dismiss();
            SecondDialog secondDialog = new SecondDialog(context);
            secondDialog.show();
            secondDialog.setOnDismissListener(v1 -> FirstDialog.this.show());

        });
        findViewById(R.id.cancel).setOnClickListener(v -> dismiss());
    }
}
